import java.util.ArrayList;
import java.util.List;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2021/12/4
 * \* Time: 15:10
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class TestDemo {
    public List<List<Integer>> generate(int numRows) {
        List<List<Integer>> ret=new ArrayList<>();
        //第一行
        //下面List是另外实例化的
        List<Integer>list1=new ArrayList<>();
        list1.add(1);

        ret.add(list1);//添加到ret当中

        for(int i=0;i<numRows;i++){
            List <Integer>list2=new ArrayList<>();
            list2.add(1);//每一行的第一个元素
            List<Integer>preRow=ret.get(i-1);//获取上一行的元素
            for (int j=1;j<i;j++){
                //一行里面中间元素情况
                int num1=preRow.get(j)+preRow.get(j-1);
                list2.add(num1);
            }
            //结尾元素都是 1
            list2.add(1);
            ret.add(list2);

        }
        return ret;
    }

    public static void main(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(2);
        myLinkedList.addFirst(3);
        System.out.print(myLinkedList.size());
        myLinkedList.display();
        System.out.println(myLinkedList.contains(1));
        myLinkedList.addLast(11);
        myLinkedList.addLast(12);
        myLinkedList.display();
    }

}
